package com.example.widgetcase.slice;

import com.example.widget_lib.widget.wave.CircleWaveView;
import com.example.widgetcase.ResourceTable;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Slider;
import ohos.agp.components.Text;

public class CircleWaveViewAbility extends BaseSlice {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        CircleWaveView waveView = (CircleWaveView) findComponentById(ResourceTable.Id_circleWv);
        Slider slider = (Slider) findComponentById(ResourceTable.Id_wave_slider);
        Text proTv = (Text) findComponentById(ResourceTable.Id_proTv);

        waveView.setPercent(50);

        slider.setProgressValue(50);
        slider.setValueChangedListener(new Slider.ValueChangedListener() {
            @Override
            public void onProgressUpdated(Slider slider, int progress, boolean b) {
                waveView.setPercent(progress);
                proTv.setText(progress + "%");
            }

            @Override
            public void onTouchStart(Slider slider) {

            }

            @Override
            public void onTouchEnd(Slider slider) {

            }
        });
    }

    @Override
    public int getChildUIContent() {
        return ResourceTable.Layout_circle_wave_view;
    }
}
